import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router);
export default new Router({
  // mode: "history",
  routes: [
    {
      path: "/",
      component: resolve => require(['../views/Login.vue'], resolve),
    },
    // {
    //   path: "/",
    //   component: resolve => require(['../views/test.vue'], resolve),
    // },

    {
      path: '/home',
      component: resolve => require(['../views/home.vue'], resolve),
      children: [
        {
          path: "/user",
          component: resolve => require(['../views/user/userList.vue'], resolve),
          meta: {
            title: '用户管理'
          }
        },
        {
          path: "/userDetail",
          component: resolve => require(['../views/user/userDetail.vue'], resolve),
          meta: {
            title: '用户详情'
          }
        },
        {
          path: "/userAgreement",
          component: resolve => require(['../views/user/userAgreement.vue'], resolve),
          meta: {
            title: '用户签署协议'
          }
        },
        {
          path: '/manage',
          component: resolve => require(['../views/manage/manageList.vue'], resolve),
          meta: {
            title: '管理员管理'
          }

        },
        {
          path: '/course',
          component: resolve => require(['../views/course/course.vue'], resolve),
          meta: {
            title: '课程管理'
          }
        },
        {
          path: '/order',
          component: resolve => require(['../views/order/orderList.vue'], resolve),
          meta: {
            title: '订单管理'
          }
        },

        {
          path: '/orderStage',
          component: resolve => require(['../views/order/orderStage.vue'], resolve),
          meta: {
            title: '订单分期'
          }
        },

        {
          path: "/project",
          component: resolve => require(['../views/project/project.vue'], resolve),
          meta: {
            title: '方案管理'
          }
        },
        {
          path: "/overdue",
          component: resolve => require(['../views/overdue/overdueList.vue'], resolve),
          meta: {
            title: '逾期催收'
          }
        },
        {
          path: "/feedBack",
          component: resolve => require(['../views/feedBack/feedBack.vue'], resolve),
          meta: {
            title: '问题反馈'
          }
        },

        {
          path: "/setUpdate",
          component: resolve => require(['../views/setUpdate/setUpdate.vue'], resolve),
          meta: {
            title: '系统配置'
          }
        },

      ]
    },
    {
      path: '*',
      redirect: '/404'
    }
  ]
})

const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}
